﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeLinkApi.Models.Request;

namespace WeLink
{
    class Program
    {
        static void Main(string[] args)
        {
            

            WeLinkApi.WeLinkApi weApi = new WeLinkApi.WeLinkApi();


            #region 会议管理
            //M_proxyRequest proxy = new M_proxyRequest()
            //{
            //    clientType = 0,
            //    authServerType = "workplace",
            //    authType = "AccountAndPwd",
            //    pwd = "zhai18317713078",
            //    createTokenType = 0,
            //    account = "18317713078"
            //};

            ////var tokenInfo= weApi.GetMeetingToken(proxy);
            ////Console.WriteLine(tokenInfo.accessToken);

            //var token = weApi.GetMeetingToken(proxy).accessToken;

            //var token = "stb4AK1EenWzcUl5MOZFHNhMAAwJ5yWPt8Yn";
            //Attendee[] attendee = {new Attendee() {
            //    accountId = "zhaichengyang@longruanyx",
            //    name = "翟承阳",
            //    role = 1,
            //    phone = "+8618317713078",
            //    isMute = 1,
            //    isAutoInvite=1
            //} };
            //M_RestScheduleRequest request = new M_RestScheduleRequest()
            //{
            //    mediaTypes = "Video,Voice",
            //    startTime = "",
            //    length = 120,
            //    attendees = attendee,
            //    conferenceType = 0,
            //    subject = "zcy的会议"
            //};
            //weApi.BookConferences(request, token);
            //M_RestLisrConfRequest request = new M_RestLisrConfRequest();
            //weApi.GetMeetingsList(request, token);

            //M_ConfInfoRequest request = new M_ConfInfoRequest()
            //{
            //    conferenceID= "914999904"
            //};
            //weApi.GetMeetingsInfo(request, token);

            //M_DeleteBookMeetingRequest request = new M_DeleteBookMeetingRequest()
            //{
            //    conferenceID = "914999904"
            //};

            //weApi.DeleteBookMeetings(request, token);
            //Attendee[] attendee = {new Attendee()
            //{
            //    accountId = "user0001",
            //    name = "user0001",
            //    role = 0,
            //    phone = "18638601770",
            //    isMute = 1
            //} };
            //M_UpdateBookMeetingRequest req = new M_UpdateBookMeetingRequest()
            //{
            //    conferenceID = "915029267",

            //    mediaTypes = "Video,Voice",
            //    startTime = "2020-03-06 05:10",
            //    length = 120,
            //    attendees = attendee,
            //    conferenceType = 0,
            //    subject = "周五早会02"
            //};


            //weApi.UpdateBookMeetings(req, token);

            #endregion

            #region WeLink通讯录

            //W_AccessTokenRequest request = new W_AccessTokenRequest()
            //{
            //    client_secret = ConfigurationManager.AppSettings["AppSecret"],
            //    client_id = ConfigurationManager.AppSettings["AppId"]
            //};
            //weApi.GetAccessTokenByID(request);

            var token = "c9e62d54-7e08-4fec-9ff7-f9507c74a78b";

            // W_UserInfoRequest userInfo = new W_UserInfoRequest() {
            //     userId = "zhaichengyang@longruanyx"
            // };
            //weApi.GetUserInfoByToken(userInfo, token);
            //W_UserAllParentRequest req = new W_UserAllParentRequest() { 
            //userId= "admin@cb6364c80c6"
            //};

            //var result= weApi.GetUserAllParentDept(req, token);


            //W_UserInfoOfDeptRequest req = new W_UserInfoOfDeptRequest()
            //{
            //    deptCode = "0"
            //};

            //var result = weApi.GetUserInfoDetailOfDept(req, token);

            //W_DeptmentInfoRequest req = new W_DeptmentInfoRequest()
            //{
            //    deptCode = "0"
            //};

            //var result = weApi.GetDeptmentInfo(req, token);
            //W_ParentDeptRequest req = new W_ParentDeptRequest()
            //{
            //    deptCode = "115263609119"
            //}; 
            //var result = weApi.GetParentDeptInfo(req, token);

            //W_ChildDeptRequest req1 = new W_ChildDeptRequest()
            //{
            //    deptCode = "0",
            //    recursiveflag=0,
            //    limit=100,
            //    offset=1
            //};

            //var result1 = weApi.GetChildDeptInfo(req1, token); 
            #endregion

            #region 异步同步
            //W_UploadUsersByAsynRequest req = new W_UploadUsersByAsynRequest()
            //{
            //    //deptCode = "115263609119"
            //};
            //var result = weApi.UploadUsersByAsyn(req, token);

            #endregion


            var dateTime= DateTime.Now.ToLocalTime();
            var dateTime1 = DateTime.UtcNow;

            //DateTime? dtnow = DateTime.UtcNow;
            //string strTmp = dtnow.ToString();
            //if (strTmp != "")
            //{
            //   var ss= TimeZone.CurrentTimeZone.ToLocalTime(Convert.ToDateTime(dtnow));
            //    Console.WriteLine(ss);
            //}

            DateTime utcNow = DateTime.Now.ToUniversalTime();

            Console.WriteLine(dateTime);
            //Console.WriteLine(dateTime1);
            Console.ReadLine();

        }
    }
}
